package BinarySearch;

public class BinarySearchLeftRightMost {
  public static void main(String[] args) {
    int arr[] = { 2, 33, 45, 45, 45, 66, 66, 77, 99 };

    LeftMost test1 = new LeftMost();
    System.out.println(test1.fn(arr, 2));
    System.out.println(test1.fn(arr, 33));
    System.out.println(test1.fn(arr, 45));
    System.out.println(test1.fn(arr, 66));
    System.out.println(test1.fn(arr, 99) + "\n");

    System.out.println(test1.fn(arr, 1)); // 0
    System.out.println(test1.fn(arr, 40)); // 2
    System.out.println(test1.fn(arr, 50)); // 5
    System.out.println(test1.fn(arr, 100) + "\n"); // 9

    RightMost test2 = new RightMost();
    System.out.println(test2.fn(arr, 2));
    System.out.println(test2.fn(arr, 33));
    System.out.println(test2.fn(arr, 45));
    System.out.println(test2.fn(arr, 66));
    System.out.println(test2.fn(arr, 99) + "\n");

    System.out.println(test2.fn(arr, 1)); // -1
    System.out.println(test2.fn(arr, 40)); // 1
    System.out.println(test2.fn(arr, 50)); // 4
    System.out.println(test2.fn(arr, 100)); // 8
  }
}
